# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

from mblog.views import *
import settings

urlpatterns = patterns(
    '',

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls), name='mblog_admin'),

    url(r'^$', index, name='mblog_index'),
    url(r'^home/$', home, name='mblog_home'),
    url(r'^users/$', userslist, name='mblog_userslist'),
    url(r'^(?P<username>\w+)/$', user_index, name='mblog_user_index'),
    url(r'^(?P<username>\w+)/tweetdetail/(?P<did>\d+)/$',
        tweetdetail, name='mblog_tweetdetail'),

    url(r'^(?P<username>\w+)/rtweet/(?P<did>\d+)/$',
        rtweet, name='mblog_rtweet'),
    url(r'^(?P<username>\w+)/replytweet_del/(?P<subuser>\w+)/(?P<did>\d+)/$',
        replytweet_del, name='mblog_replytweet_del'),
    # url(r'^(?P<username>\w+)/replytweet/(?P<did>\d+)/$',
    #     replytweet, name='mblog_replytweet'),

    # 私信
    url(r'^(?P<username>\w+)/receiverslist/$',
        receiverslist, name='mblog_receiverslist'),
    url(r'^(?P<username>\w+)/senderslist/$',
        senderslist, name='mblog_senderslist'),
    url(r'^(?P<username>\w+)/privatemsgdetail/(?P<did>\d+)/$',
        privatemsgdetail, name='mblog_privatemsgdetail'),
    url(r'^(?P<username>\w+)/privatemsg_add/(?P<dreceiver>\w+)/$',
        privatemsg_add, name='mblog_privatemsg_add'),
    url(r'^(?P<username>\w+)/privatemsg_del/(?P<did>\w+)/$',
        privatemsg_del, name='mblog_privatemsg_del'),
    url(r'^(?P<username>\w+)/privatemsg_reader/(?P<did>\w+)/$',
        privatemsg_reader, name='mblog_privatemsg_reader'),

    # 收藏
    url(r'^(?P<username>\w+)/favorite_add/(?P<tid>\d+)/$',
        favorite_add, name='mblog_favorite_add'),
    url(r'^(?P<username>\w+)/favorite_del/(?P<fid>\d+)/$',
        favorite_del, name='mblog_favorite_del'),
    url(r'^(?P<username>\w+)/favoritelist/$',
        favoritelist, name='mblog_favoritelist'),

    # 好友
    url(r'^(?P<username>\w+)/deltweet/(?P<did>\d+)/$',
        tweet_del, name='mblog_tweet_del'),

    url(r'^(?P<username>\w+)/addfollower/(?P<dfollower>\w+)/$',
        follower_add, name='mblog_follower_add'),

    url(r'^(?P<username>\w+)/delfollower/(?P<dfollower>\w+)/$',
        follower_del, name='mblog_follower_del'),

    url(r'^(?P<username>\w+)/delfan/(?P<dfan>\w+)/$',
        fan_del, name='mblog_fan_del'),

    url(r'^(?P<username>\w+)/followers/$', followers, name='mblog_followers'),
    url(r'^(?P<username>\w+)/fans/$', fans, name='mblog_fans'),

    # 用户认证
    url(r'^accounts/signin/$', signin, name='mblog_signin'),
    url(r'^accounts/signout/$', signout, name='mblog_signout'),
    url(r'^accounts/signup/$', signup, name='mblog_signup'),
    url(r'^accounts/setting/$', setting, name='mblog_setting'),
    # 资源文件
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': 'media/'}),

)
